package com.pxxy.app_homepage.utils;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.pxxy.app_homepage.entity.Information;

import java.util.List;

public class InfoJsonUtils {

    public static Gson gson = new Gson();

    public static List<Information> jsonToInfoList(String json){
        //json转化成List<Information>
        List<Information> infoList = gson.fromJson(json,new TypeToken<List<Information>>(){}.getType());

        return infoList;
    }

    public static String infoListToJson(List<Information> infoList){
        //list转化成json数据
        String json = gson.toJson(infoList);
        return json;
    }
}
